package org.example.scoresystem_backen.dto;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.example.scoresystem_backen.entity.Student;

import java.time.LocalDateTime;

/**
 * 学生数据传输对象
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class StudentDTO {

    private Integer id;
    private String sno;
    private String name;
    private String role;
    private LocalDateTime createdTime;
    private LocalDateTime updatedTime;
    private Integer classId;
    private String className;
    private String grade;

    public StudentDTO(Student student) {
        this.id = student.getId();
        this.sno = student.getSno();
        this.name = student.getName();
        this.role = student.getRole().getValue();
        this.createdTime = student.getCreatedTime();
        this.updatedTime = student.getUpdatedTime();
        this.classId = student.getClassId();
        // 这里可以后续通过Service层查询班级信息
    }
}
